<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>M站头部关闭(M station head closed)</title>
  <style>
    .top-bar {
      height: 45px;
      width: 375px;
      background-color: black;
      /* 关键 */
      overflow: hidden;
      transition: all 0.5s ease-out;

      display: flex;
      flex-direction: row;
      align-items: center;
    }

    .top-bar .delete {
      height: inherit;
      width: 30px;
      cursor: pointer;
      display: flex;
      flex-direction: row;
      justify-content: center;
      align-items: center;
    }

    .top-bar .delete img {
      height: 10px;
      width: 10px;
    }

    .top-bar .logo {
      margin-left: 3px;
      margin-right: 30px;
      height: 30px;
      width: 30px;
      cursor: pointer;
    }

    .top-bar span {
      color: white;
      font-size: 14px;
      flex: 1;

      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .top-bar .btn {
      width: 94px;
      height: inherit;
      line-height: 45px;
      text-align: center;
      font-size: 14px;
      color: #fff;
      background-color: #F63515;
    }
  </style>
</head>
<body>

  <div class="top-bar">
    <div class="delete">
      <img src="./img/delete.png" alt="">
    </div>
    <img class="logo" src="./img/logo.png" alt="">
    <span>打开京东App,购物更轻松</span>
    <div class="btn">立即打开</div>
  </div>
  
  <script>
    // 1. 获取元素
    const deleteBtn = document.querySelector('.delete')
    const topBar = document.querySelector('.top-bar')
    // 2. 添加点击事件
    deleteBtn.addEventListener('click', function () {
      // 3. 隐藏top-bar
      topBar.style.height = 0
    })

    // 4. 清除动画
    topBar.ontransitionend = function () {
      this.remove()
    }

  </script>
    
  </script>
  
</body>
</html>